package com.example.mobile2121606110syc0330homework1;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    int i=1;
    private ImageView imageView;
    private Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        button.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                if (i == 1) {
                    imageView.setImageResource(R.drawable.line01_01);
                }
                if (i == 2) {
                    imageView.setImageResource(R.drawable.line01_02);
                }
                if (i == 3) {
                    imageView.setImageResource(R.drawable.line01_03);
                }
                if (i == 4) {
                    imageView.setImageResource(R.drawable.line01_04);
                }
                if (i == 5) {
                    imageView.setImageResource(R.drawable.line01_05);
                }
                if (i == 6) {
                    imageView.setImageResource(R.drawable.line01_06);
                }
                i++;
                if (i == 7)
                    i = 1;
            }
        });
    }

    private void initView() {
        imageView = (ImageView) findViewById(R.id.imageView);
        button = (Button) findViewById(R.id.button);
    }
}